package cn.wolfcode.shop.member.utils;


import org.apache.commons.codec.digest.DigestUtils;

public class MD5Utils {
    public static final String FROM_SALT ="1a2b3c4";

    public static String PassFromFrontend(String password){
        String saltpass = ""+FROM_SALT.charAt(0)+password+FROM_SALT.charAt(2)+FROM_SALT.charAt(4);
        String MD5pass = org.apache.commons.codec.digest.DigestUtils.md5Hex(saltpass);
        return MD5pass;
    }

    public static String PassFromMD5(String password,String salt){
        String saltpass = salt+password+salt;
        String MD5pass = DigestUtils.md5Hex(saltpass);
        return MD5pass;
    }

    public static void main(String[] args) {
        String frompass = PassFromFrontend("123456");
        System.out.println(frompass);
    }
}
